//
//  MOWaitDoDetail_Doing_ideaViewCell.m
//  MobileOffice
//
//  Created by 冰冰 on 2019/6/25.
//  Copyright © 2019 com.idolmedia. All rights reserved.
//

#import "MOWaitDoDetail_Doing_ideaViewCell.h"

@interface MOWaitDoDetail_Doing_ideaViewCell ()

@property(nonatomic,strong)UILabel *nameLabel;

@property(nonatomic,strong)UILabel *dateLabel;

@property(nonatomic,strong)UILabel *descLabel;

@end

@implementation MOWaitDoDetail_Doing_ideaViewCell

+(instancetype)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    //NSString *ID = [NSString stringWithFormat:@"Cell%ld%ld",(long)[indexPath section],(long)[indexPath row]];
    NSString *ID = @"MOWaitDoDetail_Doing_ideaViewCell";
    MOWaitDoDetail_Doing_ideaViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil){
        cell = [[MOWaitDoDetail_Doing_ideaViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        [cell creatView];
    }
    return cell;
}


-(void)creatView
{
    [self addSubview:self.nameLabel];
    [self addSubview:self.dateLabel];
    [self addSubview:self.descLabel];
}


-(void)setDataDic:(NSDictionary *)dataDic
{
    self.nameLabel.attributedText = [self contentString:[NSString stringWithFormat:@"姓名：%@",dataDic[@"spr"]] subString:@"姓名："];
    
    self.dateLabel.attributedText = [self contentString:[NSString stringWithFormat:@"时间：%@",dataDic[@"sprq"]] subString:@"时间："];
    
    self.descLabel.attributedText = [self contentString:[NSString stringWithFormat:@"说明：%@",[NSString passNullForString:dataDic[@"spsm"]]] subString:@"说明："];
}


-(NSMutableAttributedString *)contentString:(NSString *)str subString:(NSString *)subString
{
    
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    NSMutableAttributedString *setString = [[NSMutableAttributedString alloc] initWithString:str];
    
    NSRange range = NSMakeRange([str rangeOfString:subString].location, [str rangeOfString:subString].length);
    
    [setString  addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];
    [setString addAttribute:NSForegroundColorAttributeName value:KBlackColor_919395 range:range];
    
    return setString;
}



#pragma mark -- k蓝记载
-(UILabel *)nameLabel
{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(33, 18, SCREEN_WIDTH - 66, 15)];
        _nameLabel.font = FONT_SIZE(13);
        _nameLabel.textColor = KBlackColor_2A2A2A;
    }
    return _nameLabel;
}


-(UILabel *)dateLabel
{
    if (!_dateLabel) {
        _dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(33, _nameLabel.bottom + 18, SCREEN_WIDTH - 66, 15)];
        _dateLabel.font = FONT_SIZE(13);
        _dateLabel.textColor = KBlackColor_2A2A2A;
    }
    return _dateLabel;
}

-(UILabel *)descLabel
{
    if (!_descLabel) {
        _descLabel = [[UILabel alloc]initWithFrame:CGRectMake(33, _dateLabel.bottom + 18, SCREEN_WIDTH - 66, 15)];
        _descLabel.font = FONT_SIZE(13);
        _descLabel.textColor = KBlackColor_2A2A2A;
    }
    return _descLabel;
}

@end
